package com.houger.ddd.seckill.constant;

import java.util.Arrays;

/**
 * @Description
 * @Date 2021/1/21 17:02
 */
public enum ApplyShopTypeEnum {
    ALL(1, "全部门店"),
    INCLUDE_SHOP(2, "指定门店"),
    EXCLUDE_SHOP(3, "排除门店"),
    UNKNOW(-1, "无门店");

    private Integer value;
    private String desc;

    ApplyShopTypeEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public Integer getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    public static ApplyShopTypeEnum getEnumByCode(int code) {
        return Arrays.stream(ApplyShopTypeEnum.values()).filter(a -> a.value.equals(code)).findFirst().orElse(UNKNOW);
    }
}
